package com.lxc.crud.service;

import com.lxc.crud.entity.User;
import com.lxc.crud.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    UserMapper userMapper;

    public void saveUser(User user){
        userMapper.insert(user);
    }

    public List<User> findUsers(String ids){
       return userMapper.selectByIds(ids);
    }

    public List<User> findUser(User user){
        return userMapper.selectByMultiCondition(user);
    }

    public int updateUser(User user){
        return userMapper.updateById(user);
    }

    public int deleteUser(int id){
        return userMapper.deleteById(id);
    }
}
